<template>
  <div class="main-card">
    <div class="page-header">
      <h2>好友通讯</h2>
      <button class="primary-btn" @click="goManage">好友管理</button>
    </div>
    <div class="grid-layout" style="grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));">
      <div class="base-card friend-card" v-for="item in friends" :key="item.id">
        <div class="p-4 friend-content">
          <div class="friend-avatar">
            <img src="@/assets/icons/friends.svg" alt="好友" width="40" height="40" />
          </div>
          <div class="friend-info">
            <div class="friend-name text-primary">{{ item.name }}</div>
            <div class="friend-status text-secondary">{{ item.status }}</div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import '@/assets/styles/common.css'

const friends = ref([
  { id: 1, name: '小明', status: '刚刚发布了一条动态：今天阳光真好！' },
  { id: 2, name: '小红', status: '分享了一篇好文章。' },
  { id: 3, name: '小刚', status: '上传了新头像。' },
])
const router = useRouter()
function goManage() {
  router.push('/main/friend-manage')
}
</script>

<style scoped>
.friend-card {
  cursor: pointer;
}

.friend-content {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

.friend-avatar {
  width: 48px;
  height: 48px;
  background: #e0e7ff;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.friend-info {
  flex: 1;
}

.friend-name {
  font-size: 1.1em;
  font-weight: bold;
  margin-bottom: 6px;
}

.friend-status {
  font-size: 0.98em;
}
</style>